﻿using House.Server.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace House.Server.WebApi.ViewModel
{
    public class StaffViewModel
    {

        /// <summary>
        /// 显示所有员工
        /// </summary>
        /// <returns></returns>
        public static dynamic StaffSelect()
        {
            /// <summary>
            /// 调用员工BLL中所有方法
            /// </summary>
            Service.System_StaffService Staff = new Service.System_StaffService();
            return Staff.Select();
        }

        /// <summary>
        /// 删除员工
        /// </summary>
        /// <returns></returns>
        public static dynamic StaffDelete(int id)
        {
            /// <summary>
            /// 调用员工BLL中所有方法
            /// </summary>
            Service.System_StaffService Staff = new Service.System_StaffService();
            return Staff.DeleteById(id);
        }

        /// <summary>
        /// 添加员工
        /// </summary>
        /// <returns></returns>
        public static dynamic StaffAdd(Staff list)
        {
            /// <summary>
            /// 调用员工BLL中所有方法
            /// </summary>
            Service.System_StaffService Staff = new Service.System_StaffService();
            return Staff.Insert(list);
        }


        /// <summary>
        /// 显示员工(根据Id查询)
        /// </summary>
        /// <returns></returns>
        public static dynamic StaffSelect1(int id)
        {
            /// <summary>
            /// 调用员工BLL中所有方法
            /// </summary>
            Service.System_StaffService Staff = new Service.System_StaffService();
            return Staff.Select(p => p.S_id == id);
        }
        /// <summary>
        /// 修改信息员工
        /// </summary>
        /// <returns></returns>

        public static dynamic StaffUpdate(Staff list)
        {
            /// <summary>
            /// 调用员工BLL中所有方法
            /// </summary>
            Service.System_StaffService Staff = new Service.System_StaffService();
            return Staff.Update(list);
        }


        /// <summary>
        /// 显示员工(查询未删除的员工)
        /// </summary>
        /// <returns></returns>
        public static dynamic StaffSelect2(int id)
        {
            /// <summary>
            /// 调用员工BLL中所有方法
            /// </summary>
            Service.System_StaffService Staff = new Service.System_StaffService();
            return Staff.Select(p => p.S_del == id);
        }
        /// <summary>
        ///左查询
        /// </summary>
        /// <returns></returns>
        public static dynamic show(int del)
        {
            Service.System_StaffService Staff = new Service.System_StaffService();
            return Staff.show(del);

        }


        public static List<System_StaffState> StaffStateShow()
        {
            Service.System_StaffService Staff = new Service.System_StaffService();
            return Staff.StatuffStateShow();
        }
         /// <summary>
        /// 登录
        /// </summary>
        /// <param name="name">账号</param>
        /// <param name="pwd">密码</param>
        /// <returns></returns>
        public static dynamic GetStaffLogin(string name, string pwd)
        {
            Service.System_StaffService Staff = new Service.System_StaffService();
            return Staff.GetStaffLogin(name, pwd);
        }


        /// <summary>
        /// 显示员工(根据添加身份证查询)
        /// </summary>
        /// <returns></returns>
        public static Staff StaffSelect3( string IDcard)
        {
            /// <summary>
            /// 调用员工BLL中所有方法
            /// </summary>
            Service.System_StaffService Staff = new Service.System_StaffService();
            return Staff.Select(p => p.S_IDcard == IDcard).FirstOrDefault();
        }
    }
}